package com.itany.corejava.code08_常用类.其他类;

import java.util.Random;

/**
 * @author MissChen
 * @version 1.0
 * @date 2023 年11月15日 14:58
 */
public class Test_Random {
    public static void main(String[] args) {
        Random random=new Random();
        System.out.println(random.nextInt());
        System.out.println(random.nextLong());
        System.out.println(random.nextDouble());
        System.out.println(random.nextFloat());
        System.out.println(random.nextBoolean());

        //获取0-2的随机整数,[0,3)->[0,2]
        System.out.println(random.nextInt(3));

        // 获取15-32的随机整数
        // y-x+1  -> 18 ->[0,18)->[15,33)
        System.out.println(random.nextInt(18)+15);
    }
}
